package com.huanzhidadi.rabbitmq.rabbitmq;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 接收延迟队列消息
 */
@Slf4j
@Component
public class DelayedMessageReceiver {

    @RabbitListener(queues = "delay_queue_1")
    public void aaa(String message) {
        SimpleDateFormat dateFormat = new SimpleDateFormat(("yyyy-MM-dd HH:mm:ss"));
        log.info("DelayedMessageReceiver : {}, {}", message, dateFormat.format(new Date()));
    }
}
